<?php
/*********************/
/*                   */
/*  Version : 5.1.0  */
/*  Author  : RM     */
/*  Comment : 071223 */
/*                   */
/*********************/

include_once( "../../global.php" );
$db = new plate( $mydbhost, $mydbuser, $mydbpw, $mydbname, ALL_PS, $mydbcharset );
$history_is_account = $_POST['history_is_account'];
$history_is_lock = $_POST['history_is_lock'];
$id = $_POST['id'];
$plate_num = $_POST['plate_num'];
$query = $db->select( "plate", "*", "plate_num={$plate_num} order by plate_num desc" );
$xxx = $db->fetch_array( $query );
if ( $history_is_account == 0 )
{
		$db->save_accountopen( $plate_num );
		$db->update( "plate", "history_is_account=1", "id={$id}" );
		$db->settle_accounts( $xxx['animal_set_id'], $plate_num, $xxx['num_a'], $xxx['num_b'], $xxx['num_c'], $xxx['num_d'], $xxx['num_e'], $xxx['num_f'], $xxx['num_g'] );
		$db->save_member_settlereport( $plate_num );
		echo 2;
}
else if ( $history_is_lock == 0 )
{
		$db->update( "plate", "history_is_lock=1", "id={$id}" );
		echo 4;
}
else if ( $history_is_lock == 1 )
{
		$db->update( "plate", "history_is_lock=0", "id={$id}" );
		echo 3;
}
?>
